home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / lptinit.com / LPTINIT.TXT < prev   
Encoding:
Text File  |  1990-10-12  |  2.7 KB  |  63 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                     LptInit
  8.  
  9.                                by J. Scott Sanbar
  10.  
  11.                                   8100 Glenwood
  12.                              Oklahoma City, OK 73114
  13.  
  14.                                  CIS: 73760,3304
  15.  
  16.  
  17.  
  18.  
  19. LPTINIT.PAS is a demonstration program, and a useful command line utility
  20. for determining the disposition of a printer.  It is written for Turbo
  21. Pascal 5.x, and also included is the compiled and ready to run executable
  22. LPTINIT.EXE.  IBM PC/XT/AT/PS/2 and true compatibles only.
  23.  
  24. BIOS interrupt $17 is often used to determine whether a printer is ready
  25. to receive output and diagnose its status.  Indeed, I used to use it
  26. and still do.  However, I found it to be inadequate in situations where
  27. a printer has been disconnected while on or has a bad cable.  In these
  28. cases, Intr. $17 would report an online printer which was not really
  29. online and which would lock up upon access.
  30.  
  31. The technique used in LptInit is to directly access the parallel port
  32. and send a reset signal to the printer.  Based on the behaviour of the
  33. status register after the reset is sent I can more reliably diagnose
  34. the true status of the printer.
  35.  
  36. The drawbacks are that the printer is reset, which usually denotes activity
  37. on the printer.  For instance, on my Panasonic KX-P1180 the printhead is
  38. returned to the left edge of the platten.  This is generally harmless
  39. and may actually be desirable but can take a little time.  Also, if an
  40. offline situation is detected the program will timeout.  I have set the
  41. timeout to a conservative level so there will be a noticeable pause,
  42. although this can easily be altered.
  43.  
  44. Therefore, this technique is best used only sparingly, perhaps at the
  45. beginning of a program or once before each printout.  Thereafter, repeated
  46. checks should use Intr. $17 or rely on the critical error handler to
  47. pass back an error condition.
  48.  
  49. This text and the program LPTINIT.PAS are both:
  50.  
  51. Copyright (C) 1990 by J. Scott Sanbar.  All rights reserved.
  52.  
  53. I hereby commit LPTINIT.PAS to the public domain, to be freely distributed,
  54. used and altered by anyone without fee.
  55.  
  56. NOTE:  One anomaly I could not resolve.  If the printer is disconnected
  57. while the printer is on but the printer is either offline or out of paper
  58. this technique will fail to diagnose the cable disconnect, but will report
  59. printer offline or out of paper, reporting the pre-disconnect status.
  60. Although this is probably not a critical problem, it is nevertheless
  61. an anomaly.  Every other situation I could think of is accurately
  62. diagnosed, at least on my equipment, and it never reports printer ready
  63. when it is not, which is the critical test.